package syntaxcolor.v4.syntaxcolor;

import org.eclipse.swt.custom.StyleRange;

import syntaxcolor.v4.syntaxcolor.rule.IRule;
import syntaxcolor.v4.syntaxcolor.rule.MultiLineRule;
import syntaxcolor.v4.syntaxcolor.rule.SingleLineRule;
import syntaxcolor.v4.syntaxcolor.rule.WordRule;

/**
 * 着色规则工厂，生成各种着色规则
 * 
 * @author wyl
 * 
 */
public final class RuleFactory {

	public static IRule createKeywordRule(String name, boolean isCaseSenstive,
			StyleRange style, String... words) {
		return new WordRule(name, isCaseSenstive, style, words);
	}

	public static IRule createKeywordRule(String name, String endStr,
			boolean isCaseSenstive, StyleRange style, String... words) {
		return new WordRule(name, endStr, isCaseSenstive, style, words);
	}

	public static IRule createSingleLineRule(String name, String startStr,
			StyleRange style) {
		return new SingleLineRule(name, startStr, style);
	}

	public static IRule createSingleLineRule(String name, String startStr,
			String endStr, char escapChar, StyleRange style) {
		return new SingleLineRule(name, startStr, endStr, escapChar, style);
	}

	public static IRule createMultiLineRule(String name, String startStr,
			String endStr, StyleRange style) {
		return new MultiLineRule(name, startStr, endStr, style);
	}

	public static IRule createMultiLineRule(String name, String startStr,
			String endStr, StyleRange style, String exceptStart) {
		return new MultiLineRule(name, startStr, endStr, style, exceptStart);
	}
}
